<?php

namespace app\admin\model\order;

use think\Model;
use app\admin\model\User;

/**
 * Order
 */
class Order extends Model {
    // 表名
    protected $name = 'order';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;
    protected $updateTime = false;


    public function user() {
        return $this->hasOne(User::class, 'id', 'user_id');
    }


    public function getStatusTextAttr($value, $data) {
        $status = [0 => '未确认', 1 => '已确认'];
        return $status[$data['status']];
    }

}